Skip to content

Conversation

erikhfj
Copy link
Member

@erikhfj erikhfj commented Oct 22, 2026

Closes #18

Summary

  • Dark theme under prefers-color-scheme. The whole palette is lifted into CSS custom properties first so it swaps in one place, and the light values are byte-identical to what they replace, so nothing changes for anyone who has not asked for dark.
  • Names cache-first as the fetch policy instead of inheriting Apollo's default, so the no-request-on-a-repeat promise is something the code states rather than something we assume.
  • Records the sustainability measures in the README with numbers, which is what the acceptance line asks for.

Numbers

File Raw Gzip
index-*.js 425.02 kB 129.12 kB
index-*.css 4.85 kB 1.73 kB
AlbumDetailPage-*.js 3.73 kB 1.30 kB
AlbumDetailPage-*.css 1.26 kB 0.53 kB

The AlbumDetailPage rows are the code-split chunk from #11 and are not part of the search page payload. The detail route is therefore already code-split and this PR only measures it, which is what #18 said it should do.

Requests for a typical search: one. The client has exactly one useQuery, so a search is a single searchAlbums request. Nothing is sent while the page is idle and nothing while the user types. Searching again for something already in the cache sends nothing.

Contrast

Every text pair is AA or better and every form-control border is 3:1 or better in the dark palette. --accent-text exists because the accent flips to a light green on dark and white on that would fail.

Pair Ratio
--text on --surface 14.0:1
--muted on --surface 6.9:1
--accent on --surface 8.4:1
--accent-text on --accent 8.1:1
--chip-text on --chip-bg 8.4:1
--header-text on --header-bg 16.3:1
--border-strong on --surface 3.4:1
--focus on --surface 7.7:1

Also fixed while in the README

The milestone row still said M2 was current, and the frontend description still said the search debounces 300 ms, which has not been true since #19 made it submit-only. That line directly contradicted the sustainability claim that typing costs nothing.

Verification

  • pnpm format:check, pnpm lint, pnpm typecheck, pnpm test (48 client, 21 server) and pnpm build
  • Bundle measured from that build; request count verified by there being exactly one useQuery in client/
  • Contrast ratios computed from the palette above rather than estimated

Lift the eight hard-coded colours into CSS custom properties so the whole
palette can be swapped in one place, then override them under
prefers-color-scheme. Light values are byte-identical to what they replace,
so nothing changes for anyone who has not asked for dark.

Contrast is AA or better for every text pair and 3:1 or better for the form
control borders. --accent-text exists because the accent flips to a light
green on dark, and white on that would fail.

Also name the cache-first fetch policy instead of inheriting Apollo's
default, so the no-request-on-a-repeat promise is something the code states.
The acceptance line for #18 asks for the measures listed with numbers, so add
a table of what each measure saves and a production build measured today.

Bundle: 425.02 kB raw / 129.12 kB gzip for the main chunk, with the album
detail route as a separate 3.73 kB chunk from #11. Requests for a typical
search: one, verified by there being exactly one useQuery in the client.

Also two stale claims while in here. The milestone row still said M2 was
current, and the frontend description still said the search debounces 300 ms,
which has not been true since #19 made it submit-only.
Copy link
Member

@rachelks rachelks left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me! Tested light and dark mode locally, and both work as expected. Approved! 😊

@rachelks rachelks merged commit d7f3b7f into main Oct 23, 2026
2 checks passed
@rachelks rachelks deleted the feat/18-baerekraft-green-web branch October 29, 2026 15:36
Sign in to join this conversation on GitHub.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bærekraft: green web measures
2 participants